'use strict';

const Controller = require('egg').Controller;

class ProductController extends Controller {
  async list() {
    const { ctx } = this;
    const query = ctx.request.query;
    console.log(query);
    const productData = await ctx.service.product.list(query);
    ctx.body = {
      code: 1,
      data: productData,
    };
  }

  async classify() {
    const { ctx } = this;
    const classifyData = await ctx.service.product.classify();
    ctx.body = {
      code: 1,
      data: classifyData,
    };
  }
}

module.exports = ProductController;
